.DEFAULT_GOAL := help
# 以目录名作为镜像，应用文件名
CURDIRNAME?=$(shell basename ${CURDIR})
# 可用参数定义 CURDATE 的值
CURDATE?=$(shell date '+%Y%m%d')
# CURDATE=latest
REGISTRY=registry.cn-shanghai.aliyuncs.com/haifengat
#REGISTRY=swr.cn-east-3.myhuaweicloud.com/haifengat/
AppName=${CURDIRNAME}

pnpm:
	pnpm build
#================================= 镜像处理 =============================#
build: # 编译 打包镜像
	docker build . -t registry.cn-shanghai.aliyuncs.com/haifengat/ctp_web:${CURDATE}
#=================================== 发布 =====================================#
docker: build
	docker push ${REGISTRY}/${CURDIRNAME}:${CURDATE}	

# docker login --username=hubert28@qq.com registry.cn-shanghai.aliyuncs.com
#--------------------------------------------------------------------------#
.PHONY: build
.PHONY: pub sub publish
.PHONY: help
help:
	@echo '镜像生成并推送:     make pub sub'
	@echo 'make -n 检查语法'
	@echo 'make xxxx CURDATE=yyyymmdd 指定日期(版本)'
